-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chargeback: Fix rate adjustment rounding bug #13331
Chargeback: Fix rate adjustment rounding bug #13331
Conversation
b5d826a
to
c5ff669
Compare
c8973a2
to
5f37575
Compare
# derived_vm_allocated_disk_storage --> bytes | ||
# derived_vm_used_disk_storage --> bytes | ||
# Scale the rate in the unit defined by user -> to the default unit of the metric | ||
MetricUnits = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MetricUnits
-> METRIC_UNITS
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A man can learn many languages. But my brain does not scale to remember all the naming conventions. :-(
Thanks for keeping an eye on me, when rubocop is not.
96d5f9e
to
3530a8c
Compare
c952f05
to
1d2c1c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this is a big improvement to the organization of the code and readability 👍
@isimluk It seems the test failures are related. |
0477fe0
to
e3c91f5
Compare
e3c91f5
to
29d1e70
Compare
ee36e91
to
074c6cb
Compare
This is teached in 7th or 8th grade, so backend developers shall comprehend.
The adjustment is function of two units. It is not function of a value. It is independent. It does not depend on each other. The value does not affect the adjustment measure.
Like they do in algebra classes.
Hash can be re-used as it refers to what MetricRollup table contains.
Then we can memoize it and save some time calculating it again and again.
Float has insufficient precision. Already 1024**-3 causes problems.
Certain version of ruby (before 2.3.3) have problems with BigDecimal.new(1) <= Float::INFINITY or Float::INFINITY >= BigDecimal.new(1) Forcing BigDecimal to float in this case will not hurt.
a6b0aa4
to
bb40e8a
Compare
Checked commits isimluk/manageiq@839660c~...bb40e8a with ruby 2.2.6, rubocop 0.46.0, and haml-lint 0.19.0 |
Thanks! Specs are now fixed. |
Thanks! |
What
Reproducer
Consider the following scenario with disk_allocation_metric:
Found in #13269.
@miq-bot add_label chargeback, bug, euwe/no